<?php
$backend = dirname(dirname(dirname(__FILE__))).DS.'backend'; //后台根路径
$qtrootpath = dirname(dirname(dirname(__FILE__)));//前台根目录
$public = dirname(dirname(dirname(__FILE__))).DS.'public'; //后台根路径
Yii::setPathOfAlias('ext', dirname(dirname(__FILE__)).DS.'extensions');
//定义一个前台的物理路径用于生产文件上传图片等等
Yii::setPathOfAlias('qtpath', $qtrootpath);
Yii::setPathOfAlias('backend',$backend);
Yii::setPathOfAlias('public',$public);
$p = Yii::getPathOfAlias('public');
return CMap::mergeArray(require($p.DS.'db.php'),array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'=>'指尖上的阅读',
    'timeZone'=>'Asia/Chongqing',
    'language'=>'zh_cn',
    'defaultController'=>'index',
	'preload'=>array('log'),
	'import'=>array(
		'application.models.*',
		'application.components.*',
        'application.extensions.*',
        'ext.giix-components.*',//giix 组件
        'ext.easyimage.EasyImage',
	),

	'modules'=>array(
		// uncomment the following to enable the Gii tool

		'gii'=>array(
			'class'=>'system.gii.GiiModule',
			'password'=>'123456',
            'generatorPaths'=>array(
                'ext.ajaxgii',
                'ext.giix-core',//giix生成器

            ),
			// If removed, Gii defaults to localhost only. Edit carefully to taste.
			'ipFilters'=>array('127.0.0.1','::1'),
		),
        'manage',
        'admin',
    ),

	// application components
	'components'=>array(
        /**
        'clientScript'=>array(
            'class' => 'application.vendor.EClientScript.EClientScript',
            'combineScriptFiles' => !YII_DEBUG, // By default this is set to true, set this to true if you'd like to combine the script files
//            //'combineCssFiles' => !YII_DEBUG, // By default this is set to true, set this to true if you'd like to combine the css files
            'combineCssFiles' =>false,
            'optimizeScriptFiles' => !YII_DEBUG, // @since: 1.1
//            'optimizeCssFiles' => !YII_DEBUG, // @since: 1.1
            'optimizeCssFiles' =>false,
//            'optimizeInlineScript' => false, // @since: 1.6, This may case response slower
//            'optimizeInlineCss' => false, // @since: 1.6, This may case response slower
        ), **/
        'easyImage' => array(
            'class' => 'application.extensions.easyimage.EasyImage',
            //'driver' => 'GD',
            //'quality' => 100,
            //'cachePath' => '/assets/easyimage/',
            //'cacheTime' => 2592000,
            //'retinaSupport' => false,
        ),
        'WordFilter'=>array(
            'class'=>'ext.WordFilter.WordFilter'
        ),
		'user'=>array(
			// enable cookie-based authentication
			'allowAutoLogin'=>true,
            //指定登录的页面
            'loginUrl'=>array('auth/login'),
		),

		// uncomment the following to enable URLs in path-format

		'urlManager'=>array(
            'urlFormat'=>'path',
            'showScriptName'=>true,
            'urlSuffix' => '/',
            'rules' => array(
                'auth/<action:\w+>'=>'auth/<action>',
                'admin/'=>array('admin/default/index'),
                'admin/<controller:\w+>/<action:\w+>'=>'admin/<controller>/<action>',
                'auth/<controller:\w+>/<action:\w+>'=>'auth/<controller>/<action>',
                '<city:\w+>'=>array('index/index'),

                '<city:\w+>/events-<theme:\w+>-<people:\w+>-<fee:\w+>-<star:\w+>-<activity:\w+>'=>array('events/index'),
                '<city:\w+>/destination-<theme:\w+>-<area:\w+>-<people:\w+>-<level:\w+>'=>array('destination/index'),
                '<city:\w+>/hotel-<theme:\w+>-<area:\w+>-<people:\w+>'=>array('hotel/index'),
                '<city:\w+>/farm-<theme:\w+>-<area:\w+>-<people:\w+>'=>array('farm/index'),
                '<city:\w+>/resort-<theme:\w+>-<area:\w+>-<people:\w+>'=>array('resort/index'),
                '<city:\w+>/events/'=>array('events/index'),
                '<city:\w+>/pick-<pick:\w+>-<area:\w+>'=>array('pick/index'),
                '<city:\w+>/destination/'=>array('destination/index'),
                '<city:\w+>/hotel/'=>array('hotel/index'),

                'destination/<token:\w+>'=>array('destination/show','urlSuffix'=>'.html'),
                'hotel/<token:\w+>'=>array('hotel/show','urlSuffix'=>'.html'),
                'farm/<token:\w+>'=>array('farm/show','urlSuffix'=>'.html'),
                'pick/<token:\w+>'=>array('pick/show','urlSuffix'=>'.html'),
                'resort/<token:\w+>'=>array('resort/show','urlSuffix'=>'.html'),
                'weekly/<token:\w+>'=>array('weekly/show','urlSuffix'=>'.html'),
                'events/<token:\w+>'=>array('events/show','urlSuffix'=>'.html'),
                '<city:\w+>/farm/'=>array('farm/index'),
                '<city:\w+>/resort/'=>array('resort/index'),
                '<city:\w+>/pick/'=>array('pick/index'),
                '<city:\w+>/weekly/'=>array('weekly/index'),
                '<city:\w+>/theme/'=>array('theme/index'),
                '<city:\w+>/keyword/'=>array('keyword/index'),


















//                '<domain:\w+>'=>array('people/index'),
//                'album/<id:\d+>/edit'=>array('album/edit'),
//                'album/<id:\d+>/liker'=>array('album/liker'),
//                'people/<id:\d+>/album'=>array('people/album'),
//
//                '<domain:\w+>/followers'=>array('people/followers'),
//                '<domain:\w+>/following'=>array('people/following'),
//                '<domain:\w+>/favoriteAlbum'=>array('people/favoriteAlbum'),
//                '<domain:\w+>/favoriteShare'=>array('people/favoriteShare'),
//                '<domain:\w+>/forward'=>array('people/forward'),
//                '<domain:\w+>/shares'=>array('people/shares'),
//
//
//                'album/<id:\d+>'=>array('album/index'),
//                'album'=>array('album/index'),
//                //'album/<id:\d+>/page/<page:\d+>/vpage/<vpage:\d+>'=>array('album/index'),
//                'search/album/<keyword:.+>'=>array('search/album'),
//                'search/share/<keyword:.+>'=>array('search/share'),
//                'share/<id:\d+>/edit'=>array('share/edit'),
//                'share/<id:\d+>/show'=>array('share/show'),
            ),
		),

        //语言文件
        'coreMessages'=>array(
            'basePath'=>'protected/messages',
        ),
		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(
				array(
					'class'=>'CFileLogRoute',
					'levels'=>'error, warning',
				),
				// uncomment the following to show log messages on web pages
				/*
				array(
					'class'=>'CWebLogRoute',
				),
				*/
			),
		),
	),

    'params'=>require(dirname(__FILE__) . '/params.php'),
));